package leetcode.editor.cn;

import com.sun.deploy.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

//Java：有效的字母异位词
public class ValidAnagram {
    public static void main(String[] args) {
        Solution solution = new ValidAnagram().new Solution();
        // TO TEST
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public boolean isAnagram(String s, String t) {
            int[] record = new int[26];

            for (int i = 0; i < s.length(); i++) {
                int i1 = s.charAt(i) - 'a';
                record[i1]++;
            }

            for (int i = 0; i < t.length(); i++) {
                int i1 = t.charAt(i) - 'a';
                record[i1]--;
            }

            for (int count : record) {
                if (count != 0) {
                    return false;
                }
            }
            return true;
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}